package com.karrysong.answerapplication.activities;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.karrysong.answerapplication.R;
import com.karrysong.answerapplication.utils.SPUtils;

import java.util.ArrayList;

import butterknife.BindView;

public class GradeActivity extends BaseActivity {

    @BindView(R.id.tv_grade_score)
    TextView tvGradeScore;
    @BindView(R.id.tv_all_score)
    TextView tvAllGradeScore;
    @BindView(R.id.tv_type)
    TextView tvType;
    @BindView(R.id.tv_question_type)
    TextView tvQuestionType;


    private ArrayList<CharSequence> titleName;
    private int grade, allGrade, type, questionType;

    @Override
    int getLayoutId() {
        return R.layout.activity_grade;
    }

    @Override
    void getPreIntent() {
//        接收传递来的数据
        Intent intent = getIntent();
        grade = intent.getIntExtra("grade", 0);
        allGrade = intent.getIntExtra("allGrade", 0);
        type = intent.getIntExtra("type", 1);
        questionType = intent.getIntExtra("questionType", 10);

    }

    @Override
    void initData() {
//        设置显示成绩分数
        tvGradeScore.setText("您的成绩是： " + grade);
        tvAllGradeScore.setText("本次总分是： " + allGrade);
        String[] s1 = {"考试", "选择题", "判断题", "填空题", "全部"};
        tvType.setText(s1[type]);
        if (questionType < 20){
            questionType -= 10;
        }else {
            questionType -= 19;
        }
        tvQuestionType.setText("" + SPUtils.get(GradeActivity.this, "thisQuestionType", "未知"));
    }


}